<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        
    </h:head>

    <f:view>
    <h:form id ="akdfjds" prependId="false" >
        <p:growl />
    <p:dataTable var="lop" value="#{lopController.getAll()}" id="list" selectionMode="single"  paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15"  selection="#{lopController.lop}" onRowSelectUpdate="uploadbutton"
                 >
        <f:facet name="header"  >
            <h:commandButton image="/resources/images/icon/plus.png"  action="#{lopController.actionNew()}" label="Tạo Môn Học"/>
        </f:facet>
         
        <p:column headerText=" Mã Học Phần" style="width:150px">      
                    <h:outputText value="#{lop.mahp}" />
        </p:column>
        <p:column headerText="Tên Học Phần" style="width:150px">
                    <h:outputText value="#{lop.tenhp}" />
        </p:column>

        <p:column headerText="Giáo Viên" style="width:150px">            
                    <h:outputText value="#{lopController.layGiaoVien(lop.magv)}" />
        </p:column>
         <p:column headerText="Môn Học" style="width:150px">            
                    <h:outputText value="#{lopController.layMonHoc(lop.mamh)}" />
        </p:column>
        <p:column headerText="Học Kỳ " style="width:150px">            
                    <h:outputText value="#{lopController.layHocKy(lop.mahk)}" />
        </p:column> 
        <p:column headerText="Action" style=" width:150px;">
               <h:commandLink value="Sửa" action="#{lopController.actionEdit}" style="padding: 20px " >
                         <f:param name="id_hocphan" value="#{lop.mahp}" />  
                         <f:param name="backpage" value ="hpshow"/>
                </h:commandLink>
            <p:commandButton value ="Xóa" action="#{lopController.delete(lop)}" ajax="true" update="akdfjds" />
        </p:column>
    </p:dataTable> 

    </h:form>
    
   </f:view>
    
   
</html>

